\hypertarget{utils_8h}{\section{utils.\-h File Reference}
\label{utils_8h}\index{utils.\-h@{utils.\-h}}
}
{\ttfamily \#include $<$assert.\-h$>$}\\*
{\ttfamily \#include $<$stdio.\-h$>$}\\*
{\ttfamily \#include $<$stdbool.\-h$>$}\\*
{\ttfamily \#include $<$stdlib.\-h$>$}\\*
{\ttfamily \#include $<$errno.\-h$>$}\\*
{\ttfamily \#include $<$string.\-h$>$}\\*
{\ttfamily \#include $<$sys/types.\-h$>$}\\*
{\ttfamily \#include $<$sys/socket.\-h$>$}\\*
{\ttfamily \#include $<$unistd.\-h$>$}\\*
{\ttfamily \#include \char`\"{}storage.\-h\char`\"{}}\\*
{\ttfamily \#include $<$time.\-h$>$}\\*
\subsection*{Classes}
\begin{DoxyCompactItemize}
\item 
struct \hyperlink{structconfig__params}{config\-\_\-params}
\begin{DoxyCompactList}\small\item\em A structure to store the configuration file's parameters. \end{DoxyCompactList}\item 
struct \hyperlink{structcheck__duplmis}{check\-\_\-duplmis}
\begin{DoxyCompactList}\small\item\em A structure to check if there is duplicate or missing parameter names. \end{DoxyCompactList}\item 
struct \hyperlink{structconfiguration}{configuration}
\item 
struct \hyperlink{structColumns}{Columns}
\item 
struct \hyperlink{structRecord}{Record}
\item 
struct \hyperlink{structTable}{Table}
\item 
struct \hyperlink{structsortedArrayTable}{sorted\-Array\-Table}
\end{DoxyCompactItemize}
\subsection*{Macros}
\begin{DoxyCompactItemize}
\item 
\hypertarget{utils_8h_a1eb73c104b484cf18752169509cebfe2}{\#define \hyperlink{utils_8h_a1eb73c104b484cf18752169509cebfe2}{M\-A\-X\-\_\-\-C\-M\-D\-\_\-\-L\-E\-N}~(1024 $\ast$ 8)}\label{utils_8h_a1eb73c104b484cf18752169509cebfe2}

\begin{DoxyCompactList}\small\item\em maximum command's length given by client to server \end{DoxyCompactList}\item 
\hypertarget{utils_8h_af855c94dc540e943632089ce7496faac}{\#define \hyperlink{utils_8h_af855c94dc540e943632089ce7496faac}{L\-O\-G}(x)~\{printf x; fflush(stdout);\}}\label{utils_8h_af855c94dc540e943632089ce7496faac}

\begin{DoxyCompactList}\small\item\em printf x to stdout, flush without needing '\par
' character \end{DoxyCompactList}\item 
\hypertarget{utils_8h_a32adf79142f0a426b5e782fb7cd4cad3}{\#define {\bfseries D\-B\-G}(x)~\{printf x; fflush(stdout);\}}\label{utils_8h_a32adf79142f0a426b5e782fb7cd4cad3}

\item 
\hypertarget{utils_8h_a51d90ea93d4b55e086cb490f7478e684}{\#define {\bfseries M\-A\-X\-\_\-\-M\-S\-G\-\_\-\-L\-E\-N}~1000}\label{utils_8h_a51d90ea93d4b55e086cb490f7478e684}

\item 
\hypertarget{utils_8h_a497f67978d53858accb67015e898458c}{\#define {\bfseries D\-E\-F\-A\-U\-L\-T\-\_\-\-C\-R\-Y\-P\-T\-\_\-\-S\-A\-L\-T}~\char`\"{}xx\char`\"{}}\label{utils_8h_a497f67978d53858accb67015e898458c}

\end{DoxyCompactItemize}
\subsection*{Functions}
\begin{DoxyCompactItemize}
\item 
int \hyperlink{utils_8h_a1b2cb5b7b1f2196710b7695c79345c72}{initial\-Check} (struct \hyperlink{structcheck__duplmis}{check\-\_\-duplmis} $\ast$check)
\begin{DoxyCompactList}\small\item\em An initializing function to set configs to 0. \end{DoxyCompactList}\item 
int \hyperlink{utils_8h_aa4d9633461f1bbdd097ce5e4351d5fe9}{check\-Name} (char $\ast$msg)
\begin{DoxyCompactList}\small\item\em Checks and parses the names of the table and key. \end{DoxyCompactList}\item 
int \hyperlink{utils_8h_adb3838ec27819f73099dee21600d9e6e}{check\-Value} (char $\ast$msg)
\begin{DoxyCompactList}\small\item\em Checks and parses the value pertaining to a key and table. \end{DoxyCompactList}\item 
int \hyperlink{utils_8h_acfa156e0a6b7e2e97a30a0e758ae9bf6}{get\-Line} (char $\ast$output, int max)
\begin{DoxyCompactList}\small\item\em Gets a line from std in to parameter output up to max. \end{DoxyCompactList}\item 
int \hyperlink{utils_8h_a4749d2382b87219e9a807a6e4b03b5b9}{num\-Digits} (int number)
\begin{DoxyCompactList}\small\item\em Returns number of digits number contains. E\-X\-: 1234 returns 4, 0 returns 1. \end{DoxyCompactList}\item 
int \hyperlink{utils_8h_a73c4a410d877b6a9358c547786f2102c}{sendall} (const int sock, const char $\ast$buf, const size\-\_\-t len)
\item 
int \hyperlink{utils_8h_ab126c8228ad72abbaed5f282709446ab}{recvline} (const int sock, char $\ast$buf, const size\-\_\-t buflen)
\item 
\hypertarget{utils_8h_a1929442fc6c4080b1fac19798cd7ff40}{int \hyperlink{utils_8h_a1929442fc6c4080b1fac19798cd7ff40}{read\-\_\-config} (const char $\ast$config\-\_\-file, struct \hyperlink{structconfig__params}{config\-\_\-params} $\ast$params, struct \hyperlink{structcheck__duplmis}{check\-\_\-duplmis} $\ast$check)}\label{utils_8h_a1929442fc6c4080b1fac19798cd7ff40}

\begin{DoxyCompactList}\small\item\em This function reads from the config file. \end{DoxyCompactList}\item 
int \hyperlink{utils_8h_af1fc75cd97fa400571647b2f2dacc5fd}{process\-\_\-config\-\_\-line} (char $\ast$line, struct \hyperlink{structconfig__params}{config\-\_\-params} $\ast$params, struct \hyperlink{structcheck__duplmis}{check\-\_\-duplmis} $\ast$check)
\item 
\hypertarget{utils_8h_a9e4d8cb085fc7d5c9093ee102fa886d1}{void \hyperlink{utils_8h_a9e4d8cb085fc7d5c9093ee102fa886d1}{logger} (F\-I\-L\-E $\ast$file, char $\ast$message)}\label{utils_8h_a9e4d8cb085fc7d5c9093ee102fa886d1}

\begin{DoxyCompactList}\small\item\em To log messages. \end{DoxyCompactList}\item 
void \hyperlink{utils_8h_afe0358d2485f7ecfb72aac9731c0ae83}{Fclose} (int \hyperlink{utils_8h_a9e4d8cb085fc7d5c9093ee102fa886d1}{logger}, int server\-File)
\begin{DoxyCompactList}\small\item\em To close the logging files. \end{DoxyCompactList}\item 
void \hyperlink{utils_8h_a2a0e843767aeea4f433a28b9c54f573a}{menu} ()
\begin{DoxyCompactList}\small\item\em Prints out the user menu. \end{DoxyCompactList}\item 
int \hyperlink{utils_8h_a7863bd8ef1b832f553899496a19bc38a}{Socket} (int family, int type, int protocol)
\begin{DoxyCompactList}\small\item\em Creates a socket. \end{DoxyCompactList}\item 
int \hyperlink{utils_8h_a9f7002b60d38cfb4dfa67a027821590d}{Accept} (int fd, struct sockaddr $\ast$sa, socklen\-\_\-t $\ast$salenptr)
\begin{DoxyCompactList}\small\item\em Accepts a peer socket. \end{DoxyCompactList}\item 
void \hyperlink{utils_8h_a3197ea5e0c5191e84754c9e1a3e6fada}{Bind} (int fd, const struct sockaddr $\ast$sa, socklen\-\_\-t salen)
\begin{DoxyCompactList}\small\item\em Binds a host socket to the server. \end{DoxyCompactList}\item 
int \hyperlink{utils_8h_a79ae5cd16901486c4dd6c56f12d4d751}{Connect\-Serv} (int fd, const struct sockaddr $\ast$sa, socklen\-\_\-t salen)
\begin{DoxyCompactList}\small\item\em This function connects to a host socket. \end{DoxyCompactList}\item 
void \hyperlink{utils_8h_ae77e75c563c8b6851e401620f423496e}{Listen} (int fd, int backlog)
\begin{DoxyCompactList}\small\item\em This function listens for peer sockets. \end{DoxyCompactList}\item 
void \hyperlink{utils_8h_ade6d4842f21ea284e126636e424e6614}{Close} (int fd)
\begin{DoxyCompactList}\small\item\em Closes the connection between client and server. \end{DoxyCompactList}\item 
int \hyperlink{utils_8h_a9a8383873c5cf5f6665c1926202ca608}{get\-Col} (char $\ast$data)
\begin{DoxyCompactList}\small\item\em Gets the number of columns. \end{DoxyCompactList}\item 
int \hyperlink{utils_8h_a4776c6bdf94cd04f6dca2960c5d4c07b}{valid\-Param} (char $\ast$$\ast$config, char $\ast$arg, char $\ast$$\ast$config\-Type, int num\-Col)
\begin{DoxyCompactList}\small\item\em Checks whether or not the column parameters are valid for setting. \end{DoxyCompactList}\item 
void \hyperlink{utils_8h_a3a5f1b6c90b656b8c238b2491efc1135}{separate\-Param} (char $\ast$$\ast$col\-Param, char $\ast$$\ast$col\-Name, char $\ast$$\ast$col\-Type, int num\-Col)
\begin{DoxyCompactList}\small\item\em Separates Param into name and type. \end{DoxyCompactList}\item 
int \hyperlink{utils_8h_aae16b01ed26e6c514d337ef122340ef5}{get\-Pred} (char $\ast$original, char $\ast$$\ast$column, char $\ast$oper, char $\ast$$\ast$value)
\begin{DoxyCompactList}\small\item\em Parses arguments from predicates. \end{DoxyCompactList}\item 
int \hyperlink{utils_8h_ac098349c842ca728cb6406ea410b82a6}{valid\-Pred\-Name} (char $\ast$$\ast$col\-Name, char $\ast$$\ast$col\-Type, int num\-Col, char $\ast$$\ast$pred\-Name, char $\ast$$\ast$pred\-Value, char $\ast$oper)
\begin{DoxyCompactList}\small\item\em Checks if the predicate name is a valid column. \end{DoxyCompactList}\item 
void \hyperlink{utils_8h_ac15f3b443495e25a90acfc763a64a646}{parse\-Arg} (char $\ast$$\ast$col\-Name, char $\ast$input, char $\ast$$\ast$col\-Value, int num\-Col)
\begin{DoxyCompactList}\small\item\em Parses name and value from databaes. \end{DoxyCompactList}\item 
char $\ast$ \hyperlink{utils_8h_a205c8acb2ef70f038f32e5fe361cc8d9}{trimwhitespace} (char $\ast$str)
\begin{DoxyCompactList}\small\item\em Trims whitespace before and after. \end{DoxyCompactList}\item 
int \hyperlink{utils_8h_a90cc9de8fcecd61d7b138930ae2968ec}{get\-Arguments\-Jer} (char $\ast$$\ast$arg, char $\ast$cmd)
\begin{DoxyCompactList}\small\item\em Gets arguments with + as delimiters. \end{DoxyCompactList}\item 
int \hyperlink{utils_8h_a46e1e74aa760d98543e5ae07edd37a0a}{get\-All\-Keys} (char $\ast$table\-Name, char $\ast$$\ast$key\-Out, int max\-\_\-keys)
\begin{DoxyCompactList}\small\item\em Gets all the keys from a specific table. \end{DoxyCompactList}\item 
int \hyperlink{utils_8h_a246f6f9f00c7d68ed7c1abe6532c9ff3}{check\-Pred\-Duplicate} (char $\ast$$\ast$pred\-Name, char $\ast$oper)
\begin{DoxyCompactList}\small\item\em Checks if there are multiple preds with same col name. \end{DoxyCompactList}\item 
void \hyperlink{utils_8h_aede2ffb99b3c2f7352ba1c6f76f88687}{initialize\-Sorted\-Array\-Table} ()
\item 
int \hyperlink{utils_8h_a37e3e6ef78c21d62d6c4e5395676089a}{insert\-Table} (char $\ast$tname)
\item 
int \hyperlink{utils_8h_a93912a4a3ecebf7f8dbe258f239d4bbf}{sort\-Table} ()
\item 
void \hyperlink{utils_8h_aa3a1d79ff87546593b238c9397fa72d4}{print\-Table\-Name} ()
\item 
int \hyperlink{utils_8h_a12dfb94bee8d17ffdc72b2e787a485e8}{find\-Table\-Name} (char $\ast$tname)
\item 
\hypertarget{utils_8h_a2a1c052770e0bca9fd7ae995e7253cac}{int {\bfseries insert\-Record} (struct \hyperlink{structTable}{Table} $\ast$\hyperlink{structtable}{table}, char $\ast$Key, char $\ast$Value)}\label{utils_8h_a2a1c052770e0bca9fd7ae995e7253cac}

\item 
int \hyperlink{utils_8h_a01f80f9186f9b69747c05decac86106b}{insert\-Value} (char $\ast$\hyperlink{structTable}{Table}, char $\ast$Key, char $\ast$Value)
\item 
void \hyperlink{utils_8h_a03d9f8353f8b69736df5dc596aa67ff4}{print\-Record} (int t\-\_\-index)
\item 
int \hyperlink{utils_8h_a337d74d69d202d7c8dbe246f375b79c3}{delete\-Record} (char $\ast$name, int t\-\_\-index)
\item 
int \hyperlink{utils_8h_a4f42ab9252cc18b3ba36da5d3a9a6422}{update\-Record} (char $\ast$name, char $\ast$value, int t\-\_\-index)
\item 
void \hyperlink{utils_8h_ae109b1f0dc646e59c84b88e9b1fc123e}{get\-Record} (char $\ast$\hyperlink{structTable}{Table}, char $\ast$Key, char $\ast$Value, int t\-\_\-index)
\item 
int \hyperlink{utils_8h_aedc3bcf96c456d4eb94b192da354e8ec}{get\-Value} (char $\ast$\hyperlink{structTable}{Table}, char $\ast$Key, char $\ast$Value)
\item 
struct \hyperlink{structRecord}{Record} $\ast$ \hyperlink{utils_8h_a8b5db22a760d610583a669759189f453}{create\-Record} (char $\ast$name, char $\ast$value)
\item 
int \hyperlink{utils_8h_a492e429bcba3d3686ca91765571969c3}{find\-Table\-Index} (char $\ast$tname)
\item 
int \hyperlink{utils_8h_a46f5ace190596614a1db0ed2b023f677}{find\-Keys} (char $\ast$$\ast$pred\-Name, char $\ast$$\ast$pred\-Value, char $\ast$oper, char $\ast$table\-Name, char $\ast$$\ast$key\-Out, int max\-\_\-keys, int num\-Col)
\item 
\hypertarget{utils_8h_aa26d27a9072e93c052cb0c7fca7909f7}{char $\ast$ \hyperlink{utils_8h_aa26d27a9072e93c052cb0c7fca7909f7}{generate\-\_\-encrypted\-\_\-password} (const char $\ast$passwd, const char $\ast$salt)}\label{utils_8h_aa26d27a9072e93c052cb0c7fca7909f7}

\begin{DoxyCompactList}\small\item\em This function generates an encrypted password. \end{DoxyCompactList}\item 
\hypertarget{utils_8h_a044fa23ba6bd03e2a37001911b0351b9}{int {\bfseries config\-\_\-parser} ()}\label{utils_8h_a044fa23ba6bd03e2a37001911b0351b9}

\end{DoxyCompactItemize}
\subsection*{Variables}
\begin{DoxyCompactItemize}
\item 
\hypertarget{utils_8h_af26b360116d78e08645bcf13aa56ae72}{static const char {\bfseries C\-O\-N\-F\-I\-G\-\_\-\-C\-O\-M\-M\-E\-N\-T\-\_\-\-C\-H\-A\-R} = '\#'}\label{utils_8h_af26b360116d78e08645bcf13aa56ae72}

\item 
\hypertarget{utils_8h_aaad504d4c9e29deb8f206fe151eebef2}{char {\bfseries message} \mbox{[}M\-A\-X\-\_\-\-M\-S\-G\-\_\-\-L\-E\-N+1\mbox{]}}\label{utils_8h_aaad504d4c9e29deb8f206fe151eebef2}

\item 
\hypertarget{utils_8h_ae81ca8cf95a9afb0692457ad1e721443}{F\-I\-L\-E $\ast$ {\bfseries file\-Server}}\label{utils_8h_ae81ca8cf95a9afb0692457ad1e721443}

\item 
\hypertarget{utils_8h_aae709fb4361ed27d229885bf09201064}{F\-I\-L\-E $\ast$ {\bfseries file\-Client}}\label{utils_8h_aae709fb4361ed27d229885bf09201064}

\item 
\hypertarget{utils_8h_a5ab49d2df060009395443ea1465199dd}{static struct \hyperlink{structsortedArrayTable}{sorted\-Array\-Table} {\bfseries top\-Table}}\label{utils_8h_a5ab49d2df060009395443ea1465199dd}

\end{DoxyCompactItemize}


\subsection{Detailed Description}
This file is used to setup configuration file, send and receive data between networks, log messages to file, and encrypt passwords 

Definition in file \hyperlink{utils_8h_source}{utils.\-h}.



\subsection{Function Documentation}
\hypertarget{utils_8h_a9f7002b60d38cfb4dfa67a027821590d}{\index{utils.\-h@{utils.\-h}!Accept@{Accept}}
\index{Accept@{Accept}!utils.h@{utils.\-h}}
\subsubsection[{Accept}]{\setlength{\rightskip}{0pt plus 5cm}int Accept (
\begin{DoxyParamCaption}
\item[{int}]{fd, }
\item[{struct sockaddr $\ast$}]{sa, }
\item[{socklen\-\_\-t $\ast$}]{salenptr}
\end{DoxyParamCaption}
)}}\label{utils_8h_a9f7002b60d38cfb4dfa67a027821590d}


Accepts a peer socket. 

This function accepts a peer socket that is trying to connect 

Definition at line 1176 of file utils.\-c.



Referenced by newconnection().

\hypertarget{utils_8h_a3197ea5e0c5191e84754c9e1a3e6fada}{\index{utils.\-h@{utils.\-h}!Bind@{Bind}}
\index{Bind@{Bind}!utils.h@{utils.\-h}}
\subsubsection[{Bind}]{\setlength{\rightskip}{0pt plus 5cm}void Bind (
\begin{DoxyParamCaption}
\item[{int}]{fd, }
\item[{const struct sockaddr $\ast$}]{sa, }
\item[{socklen\-\_\-t}]{salen}
\end{DoxyParamCaption}
)}}\label{utils_8h_a3197ea5e0c5191e84754c9e1a3e6fada}


Binds a host socket to the server. 

This function binds a host socket to the server 

Definition at line 1192 of file utils.\-c.

\hypertarget{utils_8h_aa4d9633461f1bbdd097ce5e4351d5fe9}{\index{utils.\-h@{utils.\-h}!check\-Name@{check\-Name}}
\index{check\-Name@{check\-Name}!utils.h@{utils.\-h}}
\subsubsection[{check\-Name}]{\setlength{\rightskip}{0pt plus 5cm}int check\-Name (
\begin{DoxyParamCaption}
\item[{char $\ast$}]{msg}
\end{DoxyParamCaption}
)}}\label{utils_8h_aa4d9633461f1bbdd097ce5e4351d5fe9}


Checks and parses the names of the table and key. 

This function ensures that the string msg does only contains alphanumeric characters It is used for checking table names and keys \begin{DoxyReturn}{Returns}
1 if it satisfies all requirements 0 if it does not 
\end{DoxyReturn}


Definition at line 1104 of file utils.\-c.



Referenced by get\-Pred(), process\-\_\-config\-\_\-line(), storage\-\_\-get(), storage\-\_\-query(), and storage\-\_\-set().

\hypertarget{utils_8h_a246f6f9f00c7d68ed7c1abe6532c9ff3}{\index{utils.\-h@{utils.\-h}!check\-Pred\-Duplicate@{check\-Pred\-Duplicate}}
\index{check\-Pred\-Duplicate@{check\-Pred\-Duplicate}!utils.h@{utils.\-h}}
\subsubsection[{check\-Pred\-Duplicate}]{\setlength{\rightskip}{0pt plus 5cm}int check\-Pred\-Duplicate (
\begin{DoxyParamCaption}
\item[{char $\ast$$\ast$}]{pred\-Name, }
\item[{char $\ast$}]{oper}
\end{DoxyParamCaption}
)}}\label{utils_8h_a246f6f9f00c7d68ed7c1abe6532c9ff3}


Checks if there are multiple preds with same col name. 

Checks if same col name in multiple preds 

Definition at line 1730 of file utils.\-c.



Referenced by handle\-\_\-command().

\hypertarget{utils_8h_adb3838ec27819f73099dee21600d9e6e}{\index{utils.\-h@{utils.\-h}!check\-Value@{check\-Value}}
\index{check\-Value@{check\-Value}!utils.h@{utils.\-h}}
\subsubsection[{check\-Value}]{\setlength{\rightskip}{0pt plus 5cm}int check\-Value (
\begin{DoxyParamCaption}
\item[{char $\ast$}]{msg}
\end{DoxyParamCaption}
)}}\label{utils_8h_adb3838ec27819f73099dee21600d9e6e}


Checks and parses the value pertaining to a key and table. 

This function ensures that the string msg does only contains alphanumeric characters or space It is used for checking record values \begin{DoxyReturn}{Returns}
1 if it satisfies all requirements 0 if it does not 
\end{DoxyReturn}


Definition at line 1068 of file utils.\-c.



Referenced by storage\-\_\-set(), and valid\-Pred\-Name().

\hypertarget{utils_8h_ade6d4842f21ea284e126636e424e6614}{\index{utils.\-h@{utils.\-h}!Close@{Close}}
\index{Close@{Close}!utils.h@{utils.\-h}}
\subsubsection[{Close}]{\setlength{\rightskip}{0pt plus 5cm}void Close (
\begin{DoxyParamCaption}
\item[{int}]{fd}
\end{DoxyParamCaption}
)}}\label{utils_8h_ade6d4842f21ea284e126636e424e6614}


Closes the connection between client and server. 

This function closes a file descriptor 

Definition at line 1252 of file utils.\-c.

\hypertarget{utils_8h_a79ae5cd16901486c4dd6c56f12d4d751}{\index{utils.\-h@{utils.\-h}!Connect\-Serv@{Connect\-Serv}}
\index{Connect\-Serv@{Connect\-Serv}!utils.h@{utils.\-h}}
\subsubsection[{Connect\-Serv}]{\setlength{\rightskip}{0pt plus 5cm}int Connect\-Serv (
\begin{DoxyParamCaption}
\item[{int}]{fd, }
\item[{const struct sockaddr $\ast$}]{sa, }
\item[{socklen\-\_\-t}]{salen}
\end{DoxyParamCaption}
)}}\label{utils_8h_a79ae5cd16901486c4dd6c56f12d4d751}


This function connects to a host socket. 

This function connects to a host socket 

Definition at line 1206 of file utils.\-c.

\hypertarget{utils_8h_a8b5db22a760d610583a669759189f453}{\index{utils.\-h@{utils.\-h}!create\-Record@{create\-Record}}
\index{create\-Record@{create\-Record}!utils.h@{utils.\-h}}
\subsubsection[{create\-Record}]{\setlength{\rightskip}{0pt plus 5cm}struct {\bf Record}$\ast$ create\-Record (
\begin{DoxyParamCaption}
\item[{char $\ast$}]{name, }
\item[{char $\ast$}]{value}
\end{DoxyParamCaption}
)\hspace{0.3cm}{\ttfamily [read]}}}\label{utils_8h_a8b5db22a760d610583a669759189f453}
This is the constructor for creating a new record 
\begin{DoxyParams}{Parameters}
{\em name} & of the new record \\
\hline
{\em value} & of the new record \\
\hline
\end{DoxyParams}
\begin{DoxyReturn}{Returns}
A new record structure 
\end{DoxyReturn}


Definition at line 275 of file utils.\-c.



Referenced by insert\-Value().

\hypertarget{utils_8h_a337d74d69d202d7c8dbe246f375b79c3}{\index{utils.\-h@{utils.\-h}!delete\-Record@{delete\-Record}}
\index{delete\-Record@{delete\-Record}!utils.h@{utils.\-h}}
\subsubsection[{delete\-Record}]{\setlength{\rightskip}{0pt plus 5cm}int delete\-Record (
\begin{DoxyParamCaption}
\item[{char $\ast$}]{name, }
\item[{int}]{t\-\_\-index}
\end{DoxyParamCaption}
)}}\label{utils_8h_a337d74d69d202d7c8dbe246f375b79c3}
This function deletes a record with key called name 
\begin{DoxyParams}{Parameters}
{\em name} & the key to be deleted \\
\hline
{\em t\-\_\-index} & is the index of this key in the table \\
\hline
\end{DoxyParams}
\begin{DoxyReturn}{Returns}
1 if successful and 0 if error 
\end{DoxyReturn}


Definition at line 191 of file utils.\-c.



References delete\-Record().



Referenced by delete\-Record(), and insert\-Value().

\hypertarget{utils_8h_afe0358d2485f7ecfb72aac9731c0ae83}{\index{utils.\-h@{utils.\-h}!Fclose@{Fclose}}
\index{Fclose@{Fclose}!utils.h@{utils.\-h}}
\subsubsection[{Fclose}]{\setlength{\rightskip}{0pt plus 5cm}void Fclose (
\begin{DoxyParamCaption}
\item[{int}]{logger, }
\item[{int}]{server\-File}
\end{DoxyParamCaption}
)}}\label{utils_8h_afe0358d2485f7ecfb72aac9731c0ae83}


To close the logging files. 

This function closes a file if logger was 2 
\begin{DoxyParams}{Parameters}
{\em logger} & is the logging number defined \\
\hline
{\em server\-File} & is the file to be closed, 1 is if it the server\-File, 0 if it is the client\-File \\
\hline
\end{DoxyParams}


Definition at line 1025 of file utils.\-c.



Referenced by main().

\hypertarget{utils_8h_a46f5ace190596614a1db0ed2b023f677}{\index{utils.\-h@{utils.\-h}!find\-Keys@{find\-Keys}}
\index{find\-Keys@{find\-Keys}!utils.h@{utils.\-h}}
\subsubsection[{find\-Keys}]{\setlength{\rightskip}{0pt plus 5cm}int find\-Keys (
\begin{DoxyParamCaption}
\item[{char $\ast$$\ast$}]{pred\-Name, }
\item[{char $\ast$$\ast$}]{pred\-Value, }
\item[{char $\ast$}]{oper, }
\item[{char $\ast$}]{table\-Name, }
\item[{char $\ast$$\ast$}]{key\-Out, }
\item[{int}]{max\-\_\-keys, }
\item[{int}]{num\-Col}
\end{DoxyParamCaption}
)}}\label{utils_8h_a46f5ace190596614a1db0ed2b023f677}
This function queries through every data entry to see if the key fits 

Definition at line 346 of file utils.\-c.



References find\-Table\-Index(), M\-A\-X\-\_\-\-C\-O\-L\-N\-A\-M\-E\-\_\-\-L\-E\-N, M\-A\-X\-\_\-\-V\-A\-L\-U\-E\-\_\-\-L\-E\-N, parse\-Arg(), and trimwhitespace().



Referenced by handle\-\_\-command().

\hypertarget{utils_8h_a492e429bcba3d3686ca91765571969c3}{\index{utils.\-h@{utils.\-h}!find\-Table\-Index@{find\-Table\-Index}}
\index{find\-Table\-Index@{find\-Table\-Index}!utils.h@{utils.\-h}}
\subsubsection[{find\-Table\-Index}]{\setlength{\rightskip}{0pt plus 5cm}int find\-Table\-Index (
\begin{DoxyParamCaption}
\item[{char $\ast$}]{tname}
\end{DoxyParamCaption}
)}}\label{utils_8h_a492e429bcba3d3686ca91765571969c3}
This function finds and checks if a table exists in a given function It returns the table index number 

Definition at line 289 of file utils.\-c.



Referenced by find\-Keys(), get\-All\-Keys(), get\-Value(), and insert\-Value().

\hypertarget{utils_8h_a12dfb94bee8d17ffdc72b2e787a485e8}{\index{utils.\-h@{utils.\-h}!find\-Table\-Name@{find\-Table\-Name}}
\index{find\-Table\-Name@{find\-Table\-Name}!utils.h@{utils.\-h}}
\subsubsection[{find\-Table\-Name}]{\setlength{\rightskip}{0pt plus 5cm}int find\-Table\-Name (
\begin{DoxyParamCaption}
\item[{char $\ast$}]{tname}
\end{DoxyParamCaption}
)}}\label{utils_8h_a12dfb94bee8d17ffdc72b2e787a485e8}
This function finds and checks if a table exists in a given function It returns 1 if it exists and 0 if it does not 

Definition at line 948 of file utils.\-c.



Referenced by handle\-\_\-command(), and process\-\_\-config\-\_\-line().

\hypertarget{utils_8h_a46e1e74aa760d98543e5ae07edd37a0a}{\index{utils.\-h@{utils.\-h}!get\-All\-Keys@{get\-All\-Keys}}
\index{get\-All\-Keys@{get\-All\-Keys}!utils.h@{utils.\-h}}
\subsubsection[{get\-All\-Keys}]{\setlength{\rightskip}{0pt plus 5cm}int get\-All\-Keys (
\begin{DoxyParamCaption}
\item[{char $\ast$}]{table\-Name, }
\item[{char $\ast$$\ast$}]{key\-Out, }
\item[{int}]{max\-\_\-keys}
\end{DoxyParamCaption}
)}}\label{utils_8h_a46e1e74aa760d98543e5ae07edd37a0a}


Gets all the keys from a specific table. 

Get all the keys from a specific table 

Definition at line 1682 of file utils.\-c.



References find\-Table\-Index().



Referenced by handle\-\_\-command().

\hypertarget{utils_8h_a90cc9de8fcecd61d7b138930ae2968ec}{\index{utils.\-h@{utils.\-h}!get\-Arguments\-Jer@{get\-Arguments\-Jer}}
\index{get\-Arguments\-Jer@{get\-Arguments\-Jer}!utils.h@{utils.\-h}}
\subsubsection[{get\-Arguments\-Jer}]{\setlength{\rightskip}{0pt plus 5cm}int get\-Arguments\-Jer (
\begin{DoxyParamCaption}
\item[{char $\ast$$\ast$}]{arg, }
\item[{char $\ast$}]{cmd}
\end{DoxyParamCaption}
)}}\label{utils_8h_a90cc9de8fcecd61d7b138930ae2968ec}


Gets arguments with + as delimiters. 

This function gets the arguments after the message is passed through the network The arguments has to be \char`\"{}@\char`\"{} separated since values may contain \char`\"{} \char`\"{} Jerry's version, to avoid memory issues 

Definition at line 796 of file utils.\-c.



Referenced by handle\-\_\-command().

\hypertarget{utils_8h_a9a8383873c5cf5f6665c1926202ca608}{\index{utils.\-h@{utils.\-h}!get\-Col@{get\-Col}}
\index{get\-Col@{get\-Col}!utils.h@{utils.\-h}}
\subsubsection[{get\-Col}]{\setlength{\rightskip}{0pt plus 5cm}int get\-Col (
\begin{DoxyParamCaption}
\item[{char $\ast$}]{data}
\end{DoxyParamCaption}
)}}\label{utils_8h_a9a8383873c5cf5f6665c1926202ca608}


Gets the number of columns. 

This function returns the numbers of entries which corresponds to how many columns there are 

Definition at line 1267 of file utils.\-c.



Referenced by handle\-\_\-command().

\hypertarget{utils_8h_acfa156e0a6b7e2e97a30a0e758ae9bf6}{\index{utils.\-h@{utils.\-h}!get\-Line@{get\-Line}}
\index{get\-Line@{get\-Line}!utils.h@{utils.\-h}}
\subsubsection[{get\-Line}]{\setlength{\rightskip}{0pt plus 5cm}int get\-Line (
\begin{DoxyParamCaption}
\item[{char $\ast$}]{output, }
\item[{int}]{max}
\end{DoxyParamCaption}
)}}\label{utils_8h_acfa156e0a6b7e2e97a30a0e758ae9bf6}


Gets a line from std in to parameter output up to max. 

This function gets a line from stdin and attach it to output with null terminating it 
\begin{DoxyParams}{Parameters}
{\em output} & is the string buffer to be written on \\
\hline
{\em max} & is how long the string buffer is including '\textbackslash{}0' \\
\hline
\end{DoxyParams}
\begin{DoxyReturn}{Returns}
1 if successful, 0 if an error occurred such as message pasdtised in was too long 
\end{DoxyReturn}


Definition at line 747 of file utils.\-c.



Referenced by main().

\hypertarget{utils_8h_aae16b01ed26e6c514d337ef122340ef5}{\index{utils.\-h@{utils.\-h}!get\-Pred@{get\-Pred}}
\index{get\-Pred@{get\-Pred}!utils.h@{utils.\-h}}
\subsubsection[{get\-Pred}]{\setlength{\rightskip}{0pt plus 5cm}int get\-Pred (
\begin{DoxyParamCaption}
\item[{char $\ast$}]{arg, }
\item[{char $\ast$$\ast$}]{column, }
\item[{char $\ast$}]{oper, }
\item[{char $\ast$$\ast$}]{value}
\end{DoxyParamCaption}
)}}\label{utils_8h_aae16b01ed26e6c514d337ef122340ef5}


Parses arguments from predicates. 

This function gets the predicates, returns 0 if invalid parameters 

Definition at line 1457 of file utils.\-c.



References check\-Name().



Referenced by handle\-\_\-command().

\hypertarget{utils_8h_ae109b1f0dc646e59c84b88e9b1fc123e}{\index{utils.\-h@{utils.\-h}!get\-Record@{get\-Record}}
\index{get\-Record@{get\-Record}!utils.h@{utils.\-h}}
\subsubsection[{get\-Record}]{\setlength{\rightskip}{0pt plus 5cm}void get\-Record (
\begin{DoxyParamCaption}
\item[{char $\ast$}]{Table, }
\item[{char $\ast$}]{Key, }
\item[{char $\ast$}]{Value, }
\item[{int}]{t\-\_\-index}
\end{DoxyParamCaption}
)}}\label{utils_8h_ae109b1f0dc646e59c84b88e9b1fc123e}
This function gets a record from the \hyperlink{structTable}{Table} data structure 
\begin{DoxyParams}{Parameters}
{\em \hyperlink{structTable}{Table}} & is the table to get \\
\hline
{\em Key} & is the key to get \\
\hline
{\em t\-\_\-index} & is the index of this table in the sorted array of tables \\
\hline
\end{DoxyParams}
\begin{DoxyReturn}{Returns}
1 if successful, 0 if error 
\end{DoxyReturn}


Definition at line 169 of file utils.\-c.



References get\-Record().



Referenced by get\-Record(), and get\-Value().

\hypertarget{utils_8h_aedc3bcf96c456d4eb94b192da354e8ec}{\index{utils.\-h@{utils.\-h}!get\-Value@{get\-Value}}
\index{get\-Value@{get\-Value}!utils.h@{utils.\-h}}
\subsubsection[{get\-Value}]{\setlength{\rightskip}{0pt plus 5cm}int get\-Value (
\begin{DoxyParamCaption}
\item[{char $\ast$}]{Table, }
\item[{char $\ast$}]{Key, }
\item[{char $\ast$}]{Value}
\end{DoxyParamCaption}
)}}\label{utils_8h_aedc3bcf96c456d4eb94b192da354e8ec}
assumes table exists 

Definition at line 118 of file utils.\-c.



References find\-Table\-Index(), and get\-Record().



Referenced by handle\-\_\-command().

\hypertarget{utils_8h_a1b2cb5b7b1f2196710b7695c79345c72}{\index{utils.\-h@{utils.\-h}!initial\-Check@{initial\-Check}}
\index{initial\-Check@{initial\-Check}!utils.h@{utils.\-h}}
\subsubsection[{initial\-Check}]{\setlength{\rightskip}{0pt plus 5cm}int initial\-Check (
\begin{DoxyParamCaption}
\item[{struct {\bf check\-\_\-duplmis} $\ast$}]{check}
\end{DoxyParamCaption}
)}}\label{utils_8h_a1b2cb5b7b1f2196710b7695c79345c72}


An initializing function to set configs to 0. 

This is the constructor for structure check 

Definition at line 1052 of file utils.\-c.



Referenced by main().

\hypertarget{utils_8h_aede2ffb99b3c2f7352ba1c6f76f88687}{\index{utils.\-h@{utils.\-h}!initialize\-Sorted\-Array\-Table@{initialize\-Sorted\-Array\-Table}}
\index{initialize\-Sorted\-Array\-Table@{initialize\-Sorted\-Array\-Table}!utils.h@{utils.\-h}}
\subsubsection[{initialize\-Sorted\-Array\-Table}]{\setlength{\rightskip}{0pt plus 5cm}void initialize\-Sorted\-Array\-Table (
\begin{DoxyParamCaption}
{}
\end{DoxyParamCaption}
)}}\label{utils_8h_aede2ffb99b3c2f7352ba1c6f76f88687}
create the array table to store the table information 

Definition at line 308 of file utils.\-c.

\hypertarget{utils_8h_a37e3e6ef78c21d62d6c4e5395676089a}{\index{utils.\-h@{utils.\-h}!insert\-Table@{insert\-Table}}
\index{insert\-Table@{insert\-Table}!utils.h@{utils.\-h}}
\subsubsection[{insert\-Table}]{\setlength{\rightskip}{0pt plus 5cm}int insert\-Table (
\begin{DoxyParamCaption}
\item[{char $\ast$}]{tname}
\end{DoxyParamCaption}
)}}\label{utils_8h_a37e3e6ef78c21d62d6c4e5395676089a}
This function returns 1 if table is inserted successfully, or 0 if it fails 

Definition at line 964 of file utils.\-c.



References M\-A\-X\-\_\-\-T\-A\-B\-L\-E\-S.



Referenced by process\-\_\-config\-\_\-line().

\hypertarget{utils_8h_a01f80f9186f9b69747c05decac86106b}{\index{utils.\-h@{utils.\-h}!insert\-Value@{insert\-Value}}
\index{insert\-Value@{insert\-Value}!utils.h@{utils.\-h}}
\subsubsection[{insert\-Value}]{\setlength{\rightskip}{0pt plus 5cm}int insert\-Value (
\begin{DoxyParamCaption}
\item[{char $\ast$}]{Table, }
\item[{char $\ast$}]{Key, }
\item[{char $\ast$}]{Value}
\end{DoxyParamCaption}
)}}\label{utils_8h_a01f80f9186f9b69747c05decac86106b}
\begin{DoxyNote}{Note}
must check if table exists before calling this function 4 cases If value is N\-U\-L\-L but key not found, error key not found If value is N\-U\-L\-L but key found, delete the key If Key not found, and value non Null, insert new value with key and value If Key found and value non Null, update key with value 
\end{DoxyNote}
\begin{DoxyReturn}{Returns}
-\/1 if key not found 

1 if inserted value 

2 if updated value 

3 if deleted value\mbox{]} 
\end{DoxyReturn}


Definition at line 32 of file utils.\-c.



References create\-Record(), delete\-Record(), find\-Table\-Index(), and update\-Record().



Referenced by handle\-\_\-command().

\hypertarget{utils_8h_ae77e75c563c8b6851e401620f423496e}{\index{utils.\-h@{utils.\-h}!Listen@{Listen}}
\index{Listen@{Listen}!utils.h@{utils.\-h}}
\subsubsection[{Listen}]{\setlength{\rightskip}{0pt plus 5cm}void Listen (
\begin{DoxyParamCaption}
\item[{int}]{fd, }
\item[{int}]{backlog}
\end{DoxyParamCaption}
)}}\label{utils_8h_ae77e75c563c8b6851e401620f423496e}


This function listens for peer sockets. 

This function listens for peer sockets 

Definition at line 1222 of file utils.\-c.

\hypertarget{utils_8h_a2a0e843767aeea4f433a28b9c54f573a}{\index{utils.\-h@{utils.\-h}!menu@{menu}}
\index{menu@{menu}!utils.h@{utils.\-h}}
\subsubsection[{menu}]{\setlength{\rightskip}{0pt plus 5cm}void menu (
\begin{DoxyParamCaption}
{}
\end{DoxyParamCaption}
)}}\label{utils_8h_a2a0e843767aeea4f433a28b9c54f573a}


Prints out the user menu. 

This function prints the menu to prompt the user to enter his selection 

Definition at line 1042 of file utils.\-c.



Referenced by main().

\hypertarget{utils_8h_a4749d2382b87219e9a807a6e4b03b5b9}{\index{utils.\-h@{utils.\-h}!num\-Digits@{num\-Digits}}
\index{num\-Digits@{num\-Digits}!utils.h@{utils.\-h}}
\subsubsection[{num\-Digits}]{\setlength{\rightskip}{0pt plus 5cm}int num\-Digits (
\begin{DoxyParamCaption}
\item[{int}]{number}
\end{DoxyParamCaption}
)}}\label{utils_8h_a4749d2382b87219e9a807a6e4b03b5b9}


Returns number of digits number contains. E\-X\-: 1234 returns 4, 0 returns 1. 

This function returns the number of digits contain by number 
\begin{DoxyParams}{Parameters}
{\em number} & is the integer to count number of digits \\
\hline
\end{DoxyParams}
\begin{DoxyReturn}{Returns}
the number of digits of number 
\end{DoxyReturn}


Definition at line 821 of file utils.\-c.



Referenced by storage\-\_\-connect().

\hypertarget{utils_8h_ac15f3b443495e25a90acfc763a64a646}{\index{utils.\-h@{utils.\-h}!parse\-Arg@{parse\-Arg}}
\index{parse\-Arg@{parse\-Arg}!utils.h@{utils.\-h}}
\subsubsection[{parse\-Arg}]{\setlength{\rightskip}{0pt plus 5cm}void parse\-Arg (
\begin{DoxyParamCaption}
\item[{char $\ast$$\ast$}]{col\-Name, }
\item[{char $\ast$}]{input, }
\item[{char $\ast$$\ast$}]{col\-Value, }
\item[{int}]{num\-Col}
\end{DoxyParamCaption}
)}}\label{utils_8h_ac15f3b443495e25a90acfc763a64a646}


Parses name and value from databaes. 

This function gets name and value from the input -\/ there are no fail cases because you should be passing a valid input 

Definition at line 1607 of file utils.\-c.



Referenced by find\-Keys().

\hypertarget{utils_8h_a03d9f8353f8b69736df5dc596aa67ff4}{\index{utils.\-h@{utils.\-h}!print\-Record@{print\-Record}}
\index{print\-Record@{print\-Record}!utils.h@{utils.\-h}}
\subsubsection[{print\-Record}]{\setlength{\rightskip}{0pt plus 5cm}void print\-Record (
\begin{DoxyParamCaption}
\item[{int}]{t\-\_\-index}
\end{DoxyParamCaption}
)}}\label{utils_8h_a03d9f8353f8b69736df5dc596aa67ff4}
This funciton prints all record in a chosen table t\-\_\-index is the index of the table in the linked list to be chosen from 

Definition at line 234 of file utils.\-c.



References print\-Record().



Referenced by print\-Record().

\hypertarget{utils_8h_aa3a1d79ff87546593b238c9397fa72d4}{\index{utils.\-h@{utils.\-h}!print\-Table\-Name@{print\-Table\-Name}}
\index{print\-Table\-Name@{print\-Table\-Name}!utils.h@{utils.\-h}}
\subsubsection[{print\-Table\-Name}]{\setlength{\rightskip}{0pt plus 5cm}void print\-Table\-Name (
\begin{DoxyParamCaption}
{}
\end{DoxyParamCaption}
)}}\label{utils_8h_aa3a1d79ff87546593b238c9397fa72d4}
This function prints the table name in the order they are in the array 

Definition at line 982 of file utils.\-c.



Referenced by main().

\hypertarget{utils_8h_af1fc75cd97fa400571647b2f2dacc5fd}{\index{utils.\-h@{utils.\-h}!process\-\_\-config\-\_\-line@{process\-\_\-config\-\_\-line}}
\index{process\-\_\-config\-\_\-line@{process\-\_\-config\-\_\-line}!utils.h@{utils.\-h}}
\subsubsection[{process\-\_\-config\-\_\-line}]{\setlength{\rightskip}{0pt plus 5cm}int process\-\_\-config\-\_\-line (
\begin{DoxyParamCaption}
\item[{char $\ast$}]{line, }
\item[{struct {\bf config\-\_\-params} $\ast$}]{params, }
\item[{struct {\bf check\-\_\-duplmis} $\ast$}]{check}
\end{DoxyParamCaption}
)}}\label{utils_8h_af1fc75cd97fa400571647b2f2dacc5fd}
This function processes one line from the config file and stores its value into \hyperlink{structconfig__params}{config\-\_\-params} Called by process\-\_\-config() \begin{DoxyReturn}{Returns}
-\/1 if unsuccessful
\end{DoxyReturn}
This function processes one line in the configuration file \begin{DoxyNote}{Note}
This function is called by readconfig() This function is useless for Milestone 3 and is only used for Milestone 2 since everything is done in L\-E\-X/\-Y\-A\-C\-C 
\end{DoxyNote}


Definition at line 507 of file utils.\-c.



References check\-Name(), find\-Table\-Name(), insert\-Table(), and M\-A\-X\-\_\-\-C\-O\-N\-F\-I\-G\-\_\-\-L\-I\-N\-E\-\_\-\-L\-E\-N.

\hypertarget{utils_8h_ab126c8228ad72abbaed5f282709446ab}{\index{utils.\-h@{utils.\-h}!recvline@{recvline}}
\index{recvline@{recvline}!utils.h@{utils.\-h}}
\subsubsection[{recvline}]{\setlength{\rightskip}{0pt plus 5cm}int recvline (
\begin{DoxyParamCaption}
\item[{const int}]{sock, }
\item[{char $\ast$}]{buf, }
\item[{const size\-\_\-t}]{buflen}
\end{DoxyParamCaption}
)}}\label{utils_8h_ab126c8228ad72abbaed5f282709446ab}
This function receives all data from sock 
\begin{DoxyParams}{Parameters}
{\em sock} & The sockfd to be received from \\
\hline
{\em buf} & The buffer to store data received \\
\hline
{\em buflen} & Maximum size to be received\\
\hline
\end{DoxyParams}
This function receives buffer from sock till size buflen and stores into buf. 

Definition at line 856 of file utils.\-c.



Referenced by main(), storage\-\_\-auth(), storage\-\_\-get(), storage\-\_\-query(), and storage\-\_\-set().

\hypertarget{utils_8h_a73c4a410d877b6a9358c547786f2102c}{\index{utils.\-h@{utils.\-h}!sendall@{sendall}}
\index{sendall@{sendall}!utils.h@{utils.\-h}}
\subsubsection[{sendall}]{\setlength{\rightskip}{0pt plus 5cm}int sendall (
\begin{DoxyParamCaption}
\item[{const int}]{sock, }
\item[{const char $\ast$}]{buf, }
\item[{const size\-\_\-t}]{len}
\end{DoxyParamCaption}
)}}\label{utils_8h_a73c4a410d877b6a9358c547786f2102c}
This function sends all data to sock 
\begin{DoxyParams}{Parameters}
{\em sock} & The connfd to be sent to \\
\hline
{\em buf} & the buffer to store data to be sent \\
\hline
{\em len} & Maximum size of buf to send\\
\hline
\end{DoxyParams}
This function sends all of buffer till size len to sock 

Definition at line 838 of file utils.\-c.



Referenced by handle\-\_\-command(), storage\-\_\-auth(), storage\-\_\-get(), storage\-\_\-query(), and storage\-\_\-set().

\hypertarget{utils_8h_a3a5f1b6c90b656b8c238b2491efc1135}{\index{utils.\-h@{utils.\-h}!separate\-Param@{separate\-Param}}
\index{separate\-Param@{separate\-Param}!utils.h@{utils.\-h}}
\subsubsection[{separate\-Param}]{\setlength{\rightskip}{0pt plus 5cm}void separate\-Param (
\begin{DoxyParamCaption}
\item[{char $\ast$$\ast$}]{col\-Param, }
\item[{char $\ast$$\ast$}]{col\-Name, }
\item[{char $\ast$$\ast$}]{col\-Type, }
\item[{int}]{num\-Col}
\end{DoxyParamCaption}
)}}\label{utils_8h_a3a5f1b6c90b656b8c238b2491efc1135}


Separates Param into name and type. 

This function separates the two fields inside the table params 

Definition at line 1423 of file utils.\-c.



Referenced by handle\-\_\-command().

\hypertarget{utils_8h_a7863bd8ef1b832f553899496a19bc38a}{\index{utils.\-h@{utils.\-h}!Socket@{Socket}}
\index{Socket@{Socket}!utils.h@{utils.\-h}}
\subsubsection[{Socket}]{\setlength{\rightskip}{0pt plus 5cm}int Socket (
\begin{DoxyParamCaption}
\item[{int}]{family, }
\item[{int}]{type, }
\item[{int}]{protocol}
\end{DoxyParamCaption}
)}}\label{utils_8h_a7863bd8ef1b832f553899496a19bc38a}


Creates a socket. 

This function creates a socket 

Definition at line 1236 of file utils.\-c.

\hypertarget{utils_8h_a93912a4a3ecebf7f8dbe258f239d4bbf}{\index{utils.\-h@{utils.\-h}!sort\-Table@{sort\-Table}}
\index{sort\-Table@{sort\-Table}!utils.h@{utils.\-h}}
\subsubsection[{sort\-Table}]{\setlength{\rightskip}{0pt plus 5cm}int sort\-Table (
\begin{DoxyParamCaption}
{}
\end{DoxyParamCaption}
)}}\label{utils_8h_a93912a4a3ecebf7f8dbe258f239d4bbf}
This function sorts the table array using bubble sort 

Definition at line 319 of file utils.\-c.



References M\-A\-X\-\_\-\-T\-A\-B\-L\-E\-\_\-\-L\-E\-N.

\hypertarget{utils_8h_a205c8acb2ef70f038f32e5fe361cc8d9}{\index{utils.\-h@{utils.\-h}!trimwhitespace@{trimwhitespace}}
\index{trimwhitespace@{trimwhitespace}!utils.h@{utils.\-h}}
\subsubsection[{trimwhitespace}]{\setlength{\rightskip}{0pt plus 5cm}char$\ast$ trimwhitespace (
\begin{DoxyParamCaption}
\item[{char $\ast$}]{str}
\end{DoxyParamCaption}
)}}\label{utils_8h_a205c8acb2ef70f038f32e5fe361cc8d9}


Trims whitespace before and after. 

Online found helper function to trim whitespace before and after 

Definition at line 1657 of file utils.\-c.



Referenced by find\-Keys().

\hypertarget{utils_8h_a4f42ab9252cc18b3ba36da5d3a9a6422}{\index{utils.\-h@{utils.\-h}!update\-Record@{update\-Record}}
\index{update\-Record@{update\-Record}!utils.h@{utils.\-h}}
\subsubsection[{update\-Record}]{\setlength{\rightskip}{0pt plus 5cm}int update\-Record (
\begin{DoxyParamCaption}
\item[{char $\ast$}]{name, }
\item[{char $\ast$}]{value, }
\item[{int}]{t\-\_\-index}
\end{DoxyParamCaption}
)}}\label{utils_8h_a4f42ab9252cc18b3ba36da5d3a9a6422}
This function updates a value in the table 
\begin{DoxyParams}{Parameters}
{\em name} & is the key \\
\hline
{\em value} & is the value to be changed to \\
\hline
{\em t\-\_\-index} & is the index of the sorted array table to be selected \\
\hline
\end{DoxyParams}
\begin{DoxyReturn}{Returns}
1 if successful, 0 if error 
\end{DoxyReturn}


Definition at line 253 of file utils.\-c.



References update\-Record().



Referenced by insert\-Value(), and update\-Record().

\hypertarget{utils_8h_a4776c6bdf94cd04f6dca2960c5d4c07b}{\index{utils.\-h@{utils.\-h}!valid\-Param@{valid\-Param}}
\index{valid\-Param@{valid\-Param}!utils.h@{utils.\-h}}
\subsubsection[{valid\-Param}]{\setlength{\rightskip}{0pt plus 5cm}int valid\-Param (
\begin{DoxyParamCaption}
\item[{char $\ast$$\ast$}]{config, }
\item[{char $\ast$}]{arg, }
\item[{char $\ast$$\ast$}]{config\-Type, }
\item[{int}]{num\-Col}
\end{DoxyParamCaption}
)}}\label{utils_8h_a4776c6bdf94cd04f6dca2960c5d4c07b}


Checks whether or not the column parameters are valid for setting. 

This function returns true if valid for inputting to database, false otherwise 

Definition at line 1289 of file utils.\-c.



Referenced by handle\-\_\-command().

\hypertarget{utils_8h_ac098349c842ca728cb6406ea410b82a6}{\index{utils.\-h@{utils.\-h}!valid\-Pred\-Name@{valid\-Pred\-Name}}
\index{valid\-Pred\-Name@{valid\-Pred\-Name}!utils.h@{utils.\-h}}
\subsubsection[{valid\-Pred\-Name}]{\setlength{\rightskip}{0pt plus 5cm}int valid\-Pred\-Name (
\begin{DoxyParamCaption}
\item[{char $\ast$$\ast$}]{col\-Name, }
\item[{char $\ast$$\ast$}]{col\-Type, }
\item[{int}]{num\-Col, }
\item[{char $\ast$$\ast$}]{pred\-Name, }
\item[{char $\ast$$\ast$}]{pred\-Value, }
\item[{char $\ast$}]{oper}
\end{DoxyParamCaption}
)}}\label{utils_8h_ac098349c842ca728cb6406ea410b82a6}


Checks if the predicate name is a valid column. 

This function checks if the predicate names are valid columns, 1 if fine, 0 = param error 

Definition at line 1545 of file utils.\-c.



References check\-Value().



Referenced by handle\-\_\-command().

